<!--
* @author wn
* @date 2022/05/09 11:09:46
* @description: 首页商品 组件
!-->
<template>
	<div class="goods-item">
		<router-link :to="`/product/${good.id}`" class="image">
			<img v-lazy="good.picture" alt="" />
		</router-link>
		<p class="name ellipsis-2">{{ good.name }}</p>
		<p class="desc ellipsis">{{ good.desc }}</p>
		<p class="price">&yen;{{ good.price }}</p>
		<!-- 上浮盒子 -->
		<div class="extra">
			<RouterLink to="/">
				<span>找相似</span>
				<span>发现现多宝贝 &gt;</span>
			</RouterLink>
		</div>
	</div>
</template>
<script>
export default {
	name: 'HomeGoods',
	props: {
		good: {
			type: Object,
			required: true,
		},
	},
}
</script>
<style scoped lang="less">
.goods-item {
	position: relative;
	// 上浮盒子
	overflow: hidden;
	width: 240px;
	height: 300px;
	padding: 10px 30px;
	// 透明边框
	border: 1px solid transparent;
	transition: all 0.5s;
	.image {
		display: block;
		width: 160px;
		height: 160px;
		margin: 0 auto;
		img {
			width: 100%;
			height: 100%;
		}
	}
	p {
		margin-top: 6px;
		font-size: 16px;
		&.name {
			height: 44px;
		}
		&.desc {
			color: #666;
			height: 22px;
		}
		&.price {
			margin-top: 10px;
			font-size: 20px;
			color: @priceColor;
		}
	}
	.extra {
		position: absolute;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 86px;
		background: @xtxColor;
		text-align: center;
		transform: translateY(100%);
		transition: all 0.5s;
		span {
			display: block;
			color: #fff;
			width: 120px;
			margin: 0 auto;
			line-height: 30px;
			&:first-child {
				font-size: 18px;
				border-bottom: 1px solid #fff;
				line-height: 40px;
				margin-top: 5px;
			}
		}
	}
	&:hover {
		border-color: @xtxColor;
		.extra {
			transform: none;
		}
	}
}
</style>
